package com.bang.study.day02.test;

import com.bang.study.day02.tree.BinarySearchTree;

import java.util.*;

/**
 * @Auther: Bang
 * @Date: 2019/9/11 22:00
 * @Description:
 */
public class Main {
    public static void main(String[] args) {
        BinarySearchTree<Integer> searchTree = new BinarySearchTree<>();
        int[] nums = {5, 3, 6, 8, 4, 2};
        for (int num : nums) {
            searchTree.add(num);
        }
        /////////////////
        //      5      //
        //    /   \    //
        //   3    6    //
        //  / \    \   //
        // 2  4     8  //
        /////////////////
//        System.out.println(searchTree.contains(11));
//        System.out.println(searchTree.contains(5));
//        System.out.println(searchTree.getSize());
//        System.out.println("preOrder ===============================");
//        searchTree.preOrder();
//        System.out.println();
//        searchTree.preOrderNR();
//        System.out.println("inOrder ===============================");
//        searchTree.inOrder();
//        System.out.println("postOrder ===============================");
//        searchTree.postOrder();
//        System.out.println("toString ===============================");
//
//        System.out.println(searchTree);
//        System.out.println("");
//        System.out.println("");
//
//        searchTree.levelOrder();

        Integer minimum = searchTree.minimum();
        System.out.println(minimum);
        Integer maximum = searchTree.maximum();
        System.out.println(maximum);
        List<Integer> list = new ArrayList<>();
//        while (!searchTree.isEmpty()){
////            Integer integer = searchTree.removeMax();
////            System.out.print(integer+" ");
//            list.add(searchTree.removeMin());
//        }
//        System.out.println();
//        System.out.println(list);
        System.out.println();
        searchTree.remove(3);
        searchTree.inOrder();
    }
}
